#include "Tile.h"
#include "imageloader.h"

//shiny (metallic) material property for floor tiles
GLfloat tile_shininess[] = {0.40, 0.40, 0.40, 1.0 };

Tile::Tile()
{
	glColor3f(1, 1, 1);
	Image* image = loadBMP("textures\\rustymetal.bmp");
	tileTexture = loadTexture(image);
	delete image;
}


Tile::~Tile(void)
{
}


void Tile::display()
{
	
	glPushMatrix();
		glBindTexture(GL_TEXTURE_2D, tileTexture);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
		glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

		glColor3f(1,1,0);

		// Produces the tile
		glPushMatrix();

			// Apply material properties to main tiles.
			glMaterialfv(GL_FRONT, GL_DIFFUSE, tile_shininess);
			
			glScalef(1.0, 1.0, 1.0);
			DefaultCube::display();
		glPopMatrix();
	glPopMatrix();
}
